package com.spr.enums;


import com.baomidou.mybatisplus.core.toolkit.StringUtils;

import java.util.Objects;

/**
 * 推送日志枚举
 */
public enum SprDevicePushEventTypeEnum {
    RECOED("record"),
    EVENT("event"),
    HEART("heart"),
    ;

    private final String eventType;


    SprDevicePushEventTypeEnum(String eventType) {
        this.eventType=eventType;
    }
    public static String getEventTypeString(SprDevicePushEventTypeEnum typeEnum){
        if (Objects.isNull(typeEnum)){
            return null;
        }
       return typeEnum.eventType;
    }

    public static SprDevicePushEventTypeEnum getEnumByString(String eventType){
        if (StringUtils.isBlank(eventType)){
            return null;
        }
        for (SprDevicePushEventTypeEnum value : SprDevicePushEventTypeEnum.values()) {
            if (Objects.equals(value.eventType,eventType)){
                return value;
            }
        }
        return null;

    }

}
